<!DOCTYPE html>
<html lang="zh-hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <title>页面重定向中...</title>
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: #333;
            padding: 20px;
            box-sizing: border-box;
        }
        .container {
            text-align: center;
            background: white;
            padding: 2rem 1.5rem;
            border-radius: 15px;
            box-shadow: 0 15px 35px rgba(0,0,0,0.1);
            max-width: 350px;
            width: 100%;
        }
        .spinner {
            border: 3px solid #f3f3f3;
            border-top: 3px solid #1989fa;
            border-radius: 50%;
            width: 35px;
            height: 35px;
            animation: spin 1s linear infinite;
            margin: 0 auto 20px;
        }
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        .message {
            color: #666;
            font-size: 16px;
            margin-bottom: 15px;
            line-height: 1.5;
        }
        .url-info {
            color: #999;
            font-size: 11px;
            word-break: break-all;
            margin-top: 15px;
            padding: 12px;
            background: #f8f9fa;
            border-radius: 8px;
            line-height: 1.4;
        }
        .logo {
            color: #1989fa;
            font-size: 20px;
            font-weight: bold;
            margin-bottom: 20px;
            line-height: 1.3;
        }
        .manual-link {
            margin-top: 20px;
            display: none;
        }
        .manual-link p {
            color: #666;
            font-size: 14px;
            margin-bottom: 15px;
        }
        .manual-link a {
            color: white;
            background: #1989fa;
            text-decoration: none;
            font-weight: bold;
            padding: 12px 24px;
            border-radius: 25px;
            display: inline-block;
            transition: all 0.3s ease;
            font-size: 14px;
        }
        .manual-link a:hover {
            background: #1976d2;
            transform: translateY(-2px);
        }
        .mobile-tip {
            color: #999;
            font-size: 12px;
            margin-top: 10px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="logo">广州南洋理工职业学院<br>移动端</div>
        <div class="spinner"></div>
        <div class="message">正在重定向到正确页面...</div>
        <div class="mobile-tip">请稍候，正在为您跳转</div>
        <div class="url-info" id="urlInfo"></div>
        <div class="manual-link" id="manualLink">
            <p>自动重定向失败，请点击下方按钮：</p>
            <a href="#" id="manualLinkBtn">进入移动端网站</a>
        </div>
    </div>

    <script>
        // 获取当前URL信息
        const currentPath = window.location.pathname;
        const currentSearch = window.location.search;
        const currentHash = window.location.hash;
        
        // 显示当前URL信息
        document.getElementById('urlInfo').textContent = `原始URL: ${window.location.href}`;
        
        // 构建新的Hash模式URL
        let newUrl = window.location.origin;
        
        // 如果路径不是根路径，将其转换为hash路由
        if (currentPath !== '/') {
            newUrl += '/#' + currentPath;
            if (currentSearch) {
                newUrl += currentSearch;
            }
            if (currentHash) {
                newUrl += currentHash;
            }
        } else {
            newUrl += '/';
        }
        
        console.log('移动端重定向:', window.location.href, '->', newUrl);
        
        // 设置手动链接
        document.getElementById('manualLinkBtn').href = newUrl;
        
        // 延迟800ms后重定向，移动端网络可能较慢
        setTimeout(() => {
            window.location.replace(newUrl);
        }, 800);
        
        // 如果6秒后还没有重定向成功，显示手动链接
        setTimeout(() => {
            document.getElementById('manualLink').style.display = 'block';
        }, 6000);
        
        // 防止页面被缓存
        if ('serviceWorker' in navigator) {
            navigator.serviceWorker.getRegistrations().then(function(registrations) {
                for(let registration of registrations) {
                    registration.unregister();
                }
            });
        }
    </script>
</body>
</html>
